'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index(ctx) {
    const data=await ctx.service.address.getList();

    ctx.helper.sendRes(ctx,{data});
  }

  async show(ctx){
    const data = await ctx.service.address.getList(ctx.params.id);

    ctx.helper.sendRes(ctx,{data});
    
  }
  
  async destroy(ctx){
    const data=await ctx.service.address.removeList(ctx.params.id);

    ctx.helper.sendRes(ctx,{data});
  }

  async update(ctx){
    const data=await ctx.service.address.updateList(ctx.params.id,ctx.request.body);

    ctx.helper.sendRes(ctx,{data});
  }

  async create(ctx){
    const data=await ctx.service.address.addList(ctx.request.body);

    ctx.helper.sendRes(ctx,{data});
  }
}

module.exports = HomeController;
